/* class TreeNode {
    int val ;
    TreeNode left = null;
    TreeNode right = null;

    public TreeNode(int val) {
        this.val = val;

    }
}*/
/*


class Solution {
     //返回的第一个指针，即为最小值，先定为null
     public TreeNode head = null;
     //中序遍历当前值的上一位，初值为最小值，先定为null
     public TreeNode pre = null;
     public TreeNode Convert(TreeNode pRootOfTree) {
         if(pRootOfTree == null)
             //中序递归，叶子为空则返回
             return null;
         //首先递归到最左最小值
         Convert(pRootOfTree.left);
         //找到最小值，初始化head与pre
         if(pre == null){
             head = pRootOfTree;
             pre = pRootOfTree;
         }
         //当前节点与上一节点建立连接，将pre设置为当前值
         else{
             pre.right = pRootOfTree;
             pRootOfTree.left = pre;
             pre = pRootOfTree;
         }
         Convert(pRootOfTree.right);
         return head;
     }
 }
*/


/*


class Codec {
     int INF = 0x3f3f3f3f;
     TreeNode emptyNode = new TreeNode(INF);
     public String serialize(TreeNode root) {
         if (root == null) return "";

         StringBuilder sb = new StringBuilder();
         // 使用队列进行层序遍历，起始先将 root 放入队列
         Deque<TreeNode> d = new ArrayDeque<>();
         d.addLast(root);
         while (!d.isEmpty()) {
             // 每次从队列中取出元素进行「拼接」，包括「正常节点」和「叶子节点对应的首位空节点」
             TreeNode poll = d.pollFirst();
             sb.append(poll.val + "_");
             // 如果取出的节点不为「占位节点」，则继续往下拓展，同时防止「占位节点」不继续往下拓展
             if (!poll.equals(emptyNode)) {
                 d.addLast(poll.left != null ? poll.left : emptyNode);
                 d.addLast(poll.right != null ? poll.right : emptyNode);
             }
         }
         return sb.toString();
     }

     public TreeNode deserialize(String data) {
         if (data.equals("")) return null;

         // 根据分隔符进行分割
         String[] ss = data.split("_");
         int n = ss.length;
         // 怎么序列化就怎么反序列化
         // 使用队列进行层序遍历，起始先将 root 构建出来，并放入队列
         TreeNode root = new TreeNode(Integer.parseInt(ss[0]));
         Deque<TreeNode> d = new ArrayDeque<>();
         d.addLast(root);
         for (int i = 1; i < n - 1; i += 2) {
             TreeNode poll = d.pollFirst();
             // 每次从中取出左右节点对应 val
             int a = Integer.parseInt(ss[i]), b = Integer.parseInt(ss[i + 1]);
             // 如果左节点对应的值不是 INF，则构建「真实节点」
             if (a != INF) {
                 poll.left = new TreeNode(a);
                 d.addLast(poll.left);
             }
             // 如果右节点对应的值不是 INF，则构建「真实节点」
             if (b != INF) {
                 poll.right = new TreeNode(b);
                 d.addLast(poll.right);
             }
         }
         return root;
     }
 }

    private int index = 0; // 设置全局主要是遇到了#号的时候需要直接前进并返回null
    String Serialize(TreeNode root) {
        if (root == null) return "";
        return helpSerialize(root, new StringBuilder()).toString();
    }

    private StringBuilder helpSerialize(TreeNode root, StringBuilder s) {
        if (root == null) return s;
        s.append(root.val).append("!");
        if (root.left != null) {
            helpSerialize(root.left, s);
        } else {
            s.append("#!"); // 为null的话直接添加即可
        }
        if (root.right != null) {
            helpSerialize(root.right, s);
        } else {
            s.append("#!");
        }
        return s;
    }

    TreeNode Deserialize(String str) {
        if (str == null || str.length() == 0) return null;
        String[] split = str.split("!");
        return helpDeserialize(split);
    }

    private TreeNode helpDeserialize(String[] strings) {
        if (strings[index].equals("#")) {
            index++;// 数据前进
            return null;
        }
        // 当前值作为节点已经被用
        TreeNode root = new TreeNode(Integer.valueOf(strings[index]));
        index++; // index++到达下一个需要反序列化的值
        root.left = helpDeserialize(strings);
        root.right = helpDeserialize(strings);
        return root;
    }*/

 class Test{
     public static void main(String[] args) {
         int a = 5;
         System.out.println(a);
         System.out.println((char)a);
         String s = String.valueOf(a);
         System.out.println(s);
     }
 }